package com.xjc.controller.request;

import cn.hutool.core.util.StrUtil;
import com.xjc.common.BasePageDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.flowable.engine.repository.ModelQuery;

import java.io.Serial;

/**
 * <p>
 * Description
 * </p>
 *
 * @author xiaojincai
 * @since 2025-06-10
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Schema(description = "模型分页请求参数")
public class ModelPageRequest extends BasePageDTO {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 模型key,全局唯一
     */
    @Schema(description = "模型key,全局唯一")
    private String key;

    /**
     * 模型名称
     */
    @Schema(description = "模型名称")
    private String name;

    /**
     * 模型分类
     */
    @Schema(description = "模型分类")
    private String category;

    public void fillQuery(ModelQuery query){
        if (StrUtil.isNotBlank(key)){
            query.modelKey(key);
        }
        if (StrUtil.isNotBlank(name)){
            query.modelName(name);
        }
        if (StrUtil.isNotBlank(category)){
            query.modelCategory(category);
        }
    }
}
